package Demo1;

public class Test {
    public static void main(String[] args) {
        Object o = new Object();
        {
            public boolean equals(Object obj)
            {
                return true;
            }
        }
    }
    public static void main7(String[] args) {
        System.out.println(100%3);
        System.out.println(100%3.0);
    }
    public static void main6(String[] args) {
        boolean b= true?false:true==true?false:true;
        System.out.println(b);
    }
    public static void main5(String[] args) {
        long start = System.currentTimeMillis();
        String s = "";
        for(int i =0;i<10000;i++)
        {

            s+=i;
        }
        long end = System.currentTimeMillis();
        System.out.println("Starting : " + (end - start));

        start = System.currentTimeMillis();
        StringBuffer sbf = new StringBuffer("");
        for (int i = 0;i<10000;i++)
        {
            sbf.append(i);
        }
        end = System.currentTimeMillis();
        System.out.println("StringBuffer:" + (end - start));


        start = System.currentTimeMillis();
        StringBuilder sbd = new StringBuilder("");
        for (int i = 0;i<10000;i++)
        {
            sbf.append(i);
        }
        end = System.currentTimeMillis();
        System.out.println("StringBuilder:" + (end - start));
    }





//    //StringBuilder 和 String Buffer
    public static void main3(String[] args) {
        StringBuilder sb1 = new StringBuilder("helloStringBuilder!");
        System.out.println("===================起初的");
        System.out.println(sb1);
        sb1.append("hwh");
        System.out.println(sb1 + "添加之后的");
        StringBuilder sb2 = sb1;
        System.out.println(sb1==sb2);
        System.out.println(sb1.charAt(0));
        System.out.println(sb1.length());
        System.out.println(sb1.capacity());
        sb1.setCharAt(0,'0');
        System.out.println(sb1);
        sb1.insert(0,"HWH");
        System.out.println(sb1);
    }
    public static void main2(String[] args) {
//        int a= 10;
//        int b =20;
//        int c= 10;
//        System.out.println(a==b);
//        System.out.println(a==c);

        String s1 = new String("hello");
        String s2 = new String("world");
        String s3 = new String("world");
        String s4 =s1;
        System.out.println(s1.equals(s2));
        System.out.println(s1.equals(s3));
        System.out.println(s2.equals(s3));
        System.out.println(s1.equals(s4));


    }
    public static void main1(String[] args) {
//        String str = "hello";
//        System.out.println(str);
//
//        String str2 = new String("new String");
//        System.out.println(str);
//
//        String str3 = str;
//        System.out.println(str3);
//
//        String s1 = "hello bit!";
//        System.out.println(s1);
//
//        String s2 = new String("hello world!!");
//        System.out.println(s2);
//
//        char[] array = {'h','e','l','l','o'};
//        String s3 = new String(array);
//        System.out.println(s3);
//
//        String s1 = new String("hello");
//        String s2 = new String("world");
//        String s3 =s1;
//        System.out.println(s1);
//        System.out.println(s2);
//        System.out.println(s3);


    }
}
